import { IFeidaoAiBrowserComponent } from '@dfeidao/atom-web/interfaces';
import get from '@dfeidao/atom-web/local/get';
import nodejs from '@dfeidao/atom-web/msg/nodejs';
import render from "@dfeidao/atom-web/render/render";
import Paging from "@dfeidao/fd-w000010";
import p001 from './p001';
export default async function a002(fd: IFeidaoAiBrowserComponent, a: { page_no: number }) {// 分页的响应
	// todo
	console.log('zj-000010:a002------start');
	console.log(a);
	const p = a.page_no;// 获取当前页面
	const no = get(fd, 'source2') as string;// 获取隐患源编号
	const hno = get(fd, 'hsource1') as string;// 获取隐患源特性编号
	const res = await nodejs<{ data: Array<{}>; c: number }>('wyf-hManager/zj-000010/s001', {
		hidden_source: no,
		hidden_source_feature_no: hno,
		pn: p

	});
	console.log(res);

	render(fd, res, p001, 'p001', 'inner');// 渲染
	const p1 = fd.data.node.querySelector<Paging>('[data-id="paging"]');
	console.log('page-no', p1);
	p1.setAttribute('page-no', p + '');// 改变页码
	console.log('zj-000010:a002------end');
}
